package com.renting.modules.sys.web;

import com.renting.common.entity.Result;
import com.renting.modules.sys.service.UserUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

/**
 * 上传文件
 */
@Controller
public class UserUploadController {

    @Autowired
    UserUploadService userUploadService;

    @RequestMapping(value = "v1/sys/users/excel",method = RequestMethod.POST)
    @ResponseBody
    @CrossOrigin("*")
    public String excel(MultipartFile[] files) {
        Result result = new Result();
        userUploadService.uploadExcel(files);
        result.setStatus(200);
        return result.toJSONString();
    }

}
